package com.arrList;

import java.util.ArrayList;
import java.util.Scanner;

public class FoodSell {
    private ArrayList<FoodInformation>foods=new ArrayList<>();
    private Scanner sc=new Scanner(System.in);


    public void FoodSet() {
            FoodInformation food=new FoodInformation();
            System.out.println("请输入菜品名称");
            food.setName(sc.next());
            System.out.println("请输入菜品原价");
            food.setOriginalPrice(sc.nextDouble());
            System.out.println("请输入菜品特价");
            food.setSpecialPrice(sc.nextDouble());
            System.out.println("请输入其他信息");
            food.setInfo(sc.next());
            foods.add(food);
            System.out.println("恭喜上架成功");
    }
    public void FoodShow(){
        for (int i = 0; i < foods.size(); i++) {
            FoodInformation food=foods.get(i);
            System.out.println("菜品名称:"+(food.getName()));
            System.out.println("菜品原价:"+(food.getOriginalPrice()));
            System.out.println("菜品优惠价:"+(food.getSpecialPrice()));
            System.out.println("菜品其他信息:"+(food.getInfo()));
        }
    }

    public void shar(){
        while (true) {
            System.out.println("==============");
            System.out.println("菜品管理系统");
            System.out.println("查看商品请安1");
            System.out.println("上架商品请安2");
            System.out.println("下架商品请安3");
            System.out.println("关闭系统请按4");
            System.out.println("--------------");
            switch (sc.nextInt()){
                case 1:
                    FoodShow();
                    break;
                case 2:
                    FoodSet();
                    break;
                case 3:
                    break;
                case 4:
                    return;
                default:
                    System.out.println("指令错误，请重新选择");
                    break;
            }
        }
    }

}
